package cn.ywsj.ywsjmidtier.controller;

import cn.ywsj.core.common.Result;
import cn.ywsj.ywsjmidtier.entity.DTO.GoodsSearchDTO;
import cn.ywsj.ywsjmidtier.service.GoodsService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Api(tags = "商品")
@RestController
@RequestMapping("goods")
public class GoodsContorller {
    @Autowired
    private GoodsService goodsService;

    /**
     * 查询商品列表
     * @param goodsSearchDTO
     * @return
     */
    @ApiOperation("查询商品列表")
    @GetMapping("queryGoodsList")
    public String queryGoodsList(GoodsSearchDTO goodsSearchDTO){
        return goodsService.queryGoodsList(goodsSearchDTO);
    }

    /**
     * 获取商品
     * @return
     */
    @ApiOperation("获取商品")
    @GetMapping("getGoods")
    public Result getGoods(){
        return Result.ok(goodsService.getGoods());
    }
}
